<template>
	<view>
		<navSearchBar  :zIndex="titleZindex" background="" title="关于我们" :initEenter="initEenter"></navSearchBar>
		<view class="body">
			<my-rich-text :htmlContent="content"></my-rich-text>
		</view>
		<my-guide-nav :buttonOptions="customButtonGroups" @buttonClick="onButtonClick"></my-guide-nav>
		<!-- <tn-goods-nav :fixed="true" :safeAreaInsetBottom="true" :options="[]" buttonType="round" :buttonGroups="customButtonGroups" @optionClick="onOptionClick"
		        @buttonClick="onButtonClick">
		</tn -->
		<wx-share ref="share"></wx-share>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content:'',
				
				customButtonGroups:[{
					text: '分享',
					backgroundColor: '#05C160',
					imgUrl:'/static/icon/share.png',
					color: '#FFFFFF'
				  }],
				  initEenter:false,
			}
		},
		onLoad(){
			this.getContent();
			let launchOptions = uni.getLaunchOptionsSync();
			// let pages = getCurrentPages();
			// console.log('aboutus',pages.length,launchOptions)
			// if(pages.length == 1){//若是自己分享给自己，需要显示home建，没有清楚运行内存，则启动路径还是原来的
			// 	this.initEenter = true;
			// }
		},
		methods: {
			getContent(){
				this.$http.get('/api/wechat/company/data').then((res) => {
					if(res.data.status == 200) {
						this.content = res.data.data.content||'';
					}
				})
			},
			onButtonClick(){
				let reg = new RegExp('<img(.*?)>');
				// let a="<img src='http://ip/123.png'alt=''></img>";
				let re = this.content.match(reg);
				console.log('re',re,re[1])
				let imgUrl = ''
				if(re[1]){
					let src = re[1].match(/src="(.*?)"/);
					imgUrl = src[1];
				}
				console.log('imagurl',imgUrl)
				this.$refs.share.open(imgUrl);
			}
			
		}
	}
</script>

<style lang="scss" scoped>
.body{
	padding-top:10rpx;
	padding-bottom:calc(112rpx + env(safe-area-inset-bottom));
}
</style>
